<template>
  <div id="levelcenter">
    <MemberLevel v-if="routername === 'memberlevel'"></MemberLevel>
    <LevelDetai v-if="routername === 'leveldetai'"></LevelDetai>
  </div>
</template>

<script>
  import MemberLevel from '@/pages/MemberLevel'
  import LevelDetai from '@/pages/LevelDetai'
  export default{
    name: 'levelcenter',
    components: {
      MemberLevel,
      LevelDetai
    },
    data () {
      return {
        routername: ''
      }
    },
    created () {
      this.$axios.post(this.apidomain + '/api/cust/queryCustVipLevel/' + this.getCookie('appid'), {
        wxOpenId: this.getCookie('openid')
      })
      .then((response) => {
        if (response.data.errorCode === '0') {
          if (response.data.data.vip === '0') {
            this.routername = 'leveldetai'
          } else {
            this.routername = 'memberlevel'
          }
        }
      })
      .catch((error) => {
        console.log(error)
      })
    }
  }
</script>
<style>
</style>
